  create table ex_user 
(user_id int NOT NULL PRIMARY KEY,
name varchar(50)NOT NULL,
password varchar(8) NOT NULL
)
TABLESPACE USERS
/
insert into ex_user values(1,'user_t','aaa')
/

  create table ex_country
(country_id int NOT NULL PRIMARY KEY,
name varchar(50)NOT NULL,
export varchar(1) NOT NULL,
import varchar(1) NOT NULL
)
TABLESPACE USERS;

CREATE SEQUENCE cnt_seq;

CREATE OR REPLACE TRIGGER country_id
BEFORE INSERT ON ex_country 
FOR EACH ROW

BEGIN
  SELECT cnt_seq.NEXTVAL  INTO :new.country_id   FROM   dual;
END;

CREATE OR REPLACE TRIGGER country_id
  BEFORE INSERT ON ex_country
  FOR EACH ROW
BEGIN
  :new.country_id := cnt_seq.nextval;
END;


/ 
ALTER TABLE ex_country ADD (
  CONSTRAINT ex_country_name UNIQUE (name)
);
/
create table docType
(doc_id int NOT NULL PRIMARY KEY,
name varchar(50)NOT NULL unique 
)
TABLESPACE USERS;

CREATE SEQUENCE doc_seq;


CREATE OR REPLACE TRIGGER doc_id
  BEFORE INSERT ON docType
  FOR EACH ROW
BEGIN
  :new.doc_id := doc_seq.nextval;
END;

